import 'package:flutter/material.dart';
import 'package:get/get.dart';
// import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:totaldemo/pages/evaluation/finish_evaluation.dart';
import 'package:totaldemo/pages/evaluation/no_evaluation.dart';
import 'package:totaldemo/pages/evaluation/wait_evaluation.dart';
import 'package:totaldemo/source/my_underline_indicator.dart';
import '../../utils/screen_unit.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

///我的评教
class MyDissPage extends StatefulWidget {
  const MyDissPage({Key key}) : super(key: key);

  @override
  _MyDissPageState createState() => _MyDissPageState();
}

class _MyDissPageState extends State<MyDissPage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: AppBar(
          title: Text(
            '我的评教',
            style: TextStyle(
              color: Colors.black,
              fontSize: 20.w,
            ),
          ),
          // bottom: TabBar(
          //   labelColor: Colors.black,
          //   labelStyle: TextStyle(fontSize: 18.w, fontWeight: FontWeight.bold),

          //   //选择器的color
          //   indicatorColor: Colors.blue,
          //   // indicatorPadding:EdgeInsetsGeometry.lerp(a, b, t) ,
          //   // indicatorPadding: EdgeInsets.only(top: 20),
          //   indicatorPadding: EdgeInsets.only(top: 20.w),
          //   indicator: MyUnderlineTabIndicator(
          //     borderSide: BorderSide(width: 4.0.w, color: Color(0xff5C3CAD)),
          //   ),

          //   ///指示器长短
          //   // indicatorSize: TabBarIndicatorSize.values,
          //   unselectedLabelColor: Color(0XffA3A3A3),
          //   unselectedLabelStyle:
          //       TextStyle(fontSize: 15.w, fontWeight: FontWeight.normal),
          //   tabs: [
          //     Tab(text: "待我评教"),
          //     Tab(text: "我已评教"),
          //     Tab(text: "我未评教"),
          //   ],
          // ),
          elevation: 0,
          // backgroundColor: Colors.white,
        ),
        body: TabBarLayout());
  }
}

class TabBarLayout1 extends StatelessWidget {
  const TabBarLayout1({
    Key key,
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Column(
      children: [
        Row(
          children: [
            Expanded(
                child: TabBar(
              // controller: _tabController,
              isScrollable: true,
              indicatorSize: TabBarIndicatorSize.label, //下划线跟字体长度一样
              labelColor: Color(0xff1D268E), //选中字体样式
              labelStyle: TextStyle(fontSize: 15, fontWeight: FontWeight.bold),
              unselectedLabelColor: Colors.grey,
              indicatorColor: Color(0xff1D268E),
              labelPadding: EdgeInsets.only(left: 20, bottom: 5, right: 20),
              // indicatorPadding: EdgeInsets.only(left: 10,bottom: 5),
              tabs: [
                Text('未评分'),
                Text('已评分'),
              ],
            )),
            Padding(
              padding: EdgeInsets.only(right: 10),
              child: GestureDetector(
                onTap: () {},
                // child: Image.asset('assets/images/img_search_gray.png',width: 30,height: 20,),
              ),
            )
          ],
        ),
        Expanded(
          child: TabBarView(
            children: [
              Text('data'),
              Text('data'),
            ],
          ),
        )
      ],
    );
  }
}

class TabBarLayout extends StatelessWidget {
  const TabBarLayout({
    Key key,
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return DefaultTabController(
        length: 3,
        child: Scaffold(
          appBar: AppBar(
            toolbarHeight: 40.w,
            elevation: 0,
            backgroundColor: Colors.white,
            automaticallyImplyLeading: false,
            title: Row(
              // crossAxisAlignment: CrossAxisAlignment.start,
              children: [
                Expanded(
                  child: MediaQuery.removePadding(
                    context: context,
                    removeTop: true,
                    removeLeft: true,
                    // removeRight: t,
                    child: Container(
                      height: 40.w,
                      // width: 50.w,

                      color: Colors.white,
                      // padding: EdgeInsets.all(10),
                      // padding: EdgeInsets.only(right: 90.w),
                      child: TabBar(
                        labelColor: Colors.black,
                        labelStyle: TextStyle(
                            fontSize: 15.w, fontWeight: FontWeight.bold),

                        //选择器的color
                        indicatorColor: Colors.blue,
                        // indicatorPadding:EdgeInsetsGeometry.lerp(a, b, t) ,
                        // indicatorPadding: EdgeInsets.only(top: 20),
                        indicatorPadding: EdgeInsets.only(top: 15.w),
                        indicator: MyUnderlineTabIndicator(
                          borderSide: BorderSide(
                              width: 3.0.w, color: Color(0xff5C3CAD)),
                        ),

                        ///指示器长短
                        // indicatorSize: TabBarIndicatorSize.values,
                        unselectedLabelColor: Color(0XffA3A3A3),
                        unselectedLabelStyle: TextStyle(
                            fontSize: 13.w, fontWeight: FontWeight.normal),
                        tabs: [
                          Tab(text: "待我评教"),
                          Tab(text: "我已评教"),
                          Tab(text: "我未评教"),
                        ],
                      ),
                    ),
                  ),
                ),
                Container(
                  margin: EdgeInsets.only(right: 80.w),
                )
              ],
            ),
          ),
          body: TabBarView(children: [
            WaitEvaluationWidget(),
            FinishEvaluationWidget(),
            NoEvaluationWidget(),
          ]),
        )
        //  Column(
        //
        // ),
        );
  }
}
